import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: {
      /* 别名 */
      '@': path.resolve(__dirname, './src'),
      '@a': path.resolve(__dirname, './src/assets')
    }
  },
  publicDir: 'public',
  server: {
    host: '192.168.3.21',
    port: 3001,
    open: false,
    strictPort: false,
    https: true,
    proxy: {
      '/api': {
        target: 'https://d1000.itactic.com.cn/', //代理接口
        changeOrigin: true
      }
      // '/wskxoss': {
      //   target: 'https://wskxoss.oss-cn-hangzhou.aliyuncs.com', //代理接口
      //   changeOrigin: true
      // }
    }
  },
  css: {
    //指定传递给 CSS 预处理器的选项
    preprocessorOptions: {
      scss: {
        charset: false,
        additionalData: `@import "@a/style/global.scss";` //添加公共样式
      }
    }
  },
  // 生产模式打包配置
  build: {
    outDir: 'build'
  }
})
